package work20240808.work3;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Money {
    private final ArrayList<Integer> money;

    public Money() {
        this.money = new ArrayList<>(List.of(10, 6, 20, 50, 100, 200, 500, 800, 2, 80, 300, 700));
    }

    public synchronized Integer drawMoney() {
        if (!money.isEmpty()) {
            Random random = new Random();
            int index = random.nextInt(money.size());
            return money.remove(index);
        }
        return null;
    }
}
